window.addEventListener("load", function () {
	// 导航栏移入效果
	$( "header ul li" ).forEach(function (v) { 
		v.addEventListener("mouseover", function () { 
			this.className = "active"
		})
		v.addEventListener("mouseout", function () { 
			this.className = ""
		})

	})
	// api鼠标移入效果
	// 遍历节点
	$(".api ul li").forEach(function (v) {
		// 鼠标移入效果
		v.addEventListener("mouseover", function () {
			this.style.backgroundColor = "#2f7ee9";
			this.style.color = "#fff";
			let imgUrl = this.firstElementChild.src;
			this.firstElementChild.src = imgUrl.replace(".svg", "-c.svg");
		});
		// 鼠标移出效果
		v.addEventListener("mouseout", function () {
			this.style.backgroundColor = "#fff";
			this.style.color = "#000";
			let imgUrl = this.firstElementChild.src;
			this.firstElementChild.src = imgUrl.replace("-c.svg", ".svg");
		});
	});
	// 独角兽区轮播图
	const fathers = $(".father");
	fathers[0].style.opacity = "1";
	let index = 1;
	this.window.setInterval(function () {
		fathers.forEach(function (v) {
			v.style.opacity = "0";
		});
		fathers[index].style.opacity = "1";
		index++;
		if (index > fathers.length - 1) {
			index = 0;
		}
	}, 3000);

	var mySwiper = new Swiper(".swiper", {
		autoplay: true,
		pagination: {
			el: ".swiper-pagination",
			clickable: true,
		},
	});
});
